Skip to content

[DNM][env_op_images] Add unit tests for verify_pulled_report_crio#3914

Open
nemarjan wants to merge 1 commit into
openstack-k8s-operators:mainfrom
nemarjan:verify-pulled-report-unit-test
Open

[DNM][env_op_images] Add unit tests for verify_pulled_report_crio#3914
nemarjan wants to merge 1 commit into
openstack-k8s-operators:mainfrom
nemarjan:verify-pulled-report-unit-test

Conversation

@nemarjan
Copy link
Copy Markdown
Contributor

@nemarjan nemarjan commented May 8, 2026

Add focused unit coverage for CRI-O pulled report verification, including successful enrichment, cross-node evidence accounting, and failure when no logs are provided. Reuse shared test utilities with a local fallback so tests run in both collection-style and local environments.

Assisted-By: Cursor Code

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from nemarjan. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@nemarjan
Copy link
Copy Markdown
Contributor Author

nemarjan commented May 8, 2026

recheck

1 similar comment
@nemarjan
Copy link
Copy Markdown
Contributor Author

nemarjan commented May 8, 2026

recheck

@nemarjan nemarjan changed the title [DNM] [env_op_images] Add unit tests for verify_pulled_report_crio [env_op_images] Add unit tests for verify_pulled_report_crio May 11, 2026
@nemarjan nemarjan requested review from a team, Valkyrie00 and evallesp May 11, 2026 08:15
@nemarjan nemarjan marked this pull request as ready for review May 11, 2026 08:56
@nemarjan nemarjan force-pushed the verify-pulled-report-unit-test branch from ad595db to b32c182 Compare May 11, 2026 10:35
Copy link
Copy Markdown
Contributor

@evallesp evallesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, some questions.

Comment thread tests/unit/modules/test_verify_pulled_report_crio.py
"image_id": "quay.io/demo/other@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"node": "node-b",
},
{"image_id": "no-digest-here", "node": "node-a"},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) question: Do we need this? I'm unsure if we're using somewhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this entry is needed as it exercises the skip branch in run_module() where images without a sha256: digest are ignored. In practice, digest-less images can appear when containers are referenced by tag only (e.g. quay.io/demo/app:latest) and the report captures the image_id before CRI-O resolves it, or when images are locally built/imported without a registry digest. The module can't match these against CRI-O pull logs, so it skips them. This test entry ensures the skip works correctly and that entries_with_digest only counts images that actually carry a digest (2, not 3).

with self.assertRaises(AnsibleFailJson) as rst:
VERIFY_MODULE.run_module()

self.assertIn("No CRI-O log files", rst.exception.args[0]["msg"])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(blocking) question:I guess we can have more tests case for the exception at L211, L215, L175

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed below , each of these exception paths now has a dedicated test:

L175 (IOError in log reading) → test_fails_when_log_file_unreadable
L211 (IOError in report reading) → test_fails_when_report_unreadable
L215 (YAMLError in parsing) → test_fails_when_report_has_invalid_yaml"

@nemarjan nemarjan changed the title [env_op_images] Add unit tests for verify_pulled_report_crio [DNM][env_op_images] Add unit tests for verify_pulled_report_crio May 11, 2026
@nemarjan nemarjan force-pushed the verify-pulled-report-unit-test branch from b32c182 to 2371b09 Compare May 11, 2026 13:07
@nemarjan nemarjan force-pushed the verify-pulled-report-unit-test branch 2 times, most recently from f29c7d2 to cdc44cd Compare May 11, 2026 15:28
@nemarjan
Copy link
Copy Markdown
Contributor Author

recheck

@centosinfra-prod-github-app
Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/93243bde94aa407093b339db46f09f8d

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 11m 28s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 29m 56s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 31m 15s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 1h 58m 23s
✔️ cifmw-pod-zuul-files SUCCESS in 7m 35s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 11m 27s
cifmw-pod-pre-commit FAILURE in 11m 27s
✔️ cifmw-molecule-env_op_images SUCCESS in 24m 29s

Add focused unit coverage for CRI-O pulled report verification, including
successful enrichment, cross-node evidence accounting, and failure when no logs
are provided. Reuse shared test utilities with a local fallback so tests run
in both collection-style and local environments.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: nemarjan <nemarjan@redhat.com>
@nemarjan nemarjan force-pushed the verify-pulled-report-unit-test branch from cdc44cd to ef38a7e Compare May 13, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants